#!/bin/sh
#(c) Copyright Barry Kauler sept 2011 bkhome.org
#License GPL3 (/usr/share/doc/legal)
#like kill but special code to kill /usr/bin/pupdialog dlgs.
#PID is passed in.
#see /usr/sbin/shutdownconfig for example of usage.

[ ! $1 ] && exit

ALLPS="`busybox ps`"

pdPID="`echo "$ALLPS" | grep "PUP${1}DLG" | cut -f 1 -d ' ' | tr '\n' ' '`" #get PID of pupdialog window.
if [ "$pdPID" ];then
 kill $pdPID 2>/dev/null
 sleep 0.2
fi

kill $1 2>/dev/null

###END###
